package com.wanxi.config;

import com.wanxi.config.interceptor.CodeFlashInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * @author Chengbo Zhang
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    CodeFlashInterceptor codeFlashInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(codeFlashInterceptor)
                //拦截的路径
                .addPathPatterns("/code");
    }
}
